package com.weijing.pretty_app.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import com.weijing.pretty_app.R
import com.weijing.pretty_app.databinding.FragmentHelpBinding

class HelpFragment : Fragment() {

    private lateinit var binding: FragmentHelpBinding

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        binding = FragmentHelpBinding.inflate(inflater, container, false)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        binding.helpTvPrecautions.setOnClickListener {
            binding.helpTvPrecautions.setBackgroundResource(R.drawable.shape_white_left10)
            binding.helpTvOperation.setBackgroundColor(
                ContextCompat.getColor(
                    requireContext(), R.color.color_00C1CD
                )
            )
            binding.helpTvPost.setBackgroundResource(R.drawable.shape_00c1cd_rigt10)


            binding.helpTvPrecautions.setTextColor(
                ContextCompat.getColor(
                    requireContext(), R.color.color_00C1CD
                )
            )
            binding.helpTvOperation.setTextColor(
                ContextCompat.getColor(
                    requireContext(), R.color.white
                )
            )
            binding.helpTvPost.setTextColor(
                ContextCompat.getColor(
                    requireContext(), R.color.white
                )
            )


            binding.helpTvContent.setText(R.string.Precautions_value)
        }


        binding.helpTvOperation.setOnClickListener {
            binding.helpTvOperation.setBackgroundColor(
                ContextCompat.getColor(
                    requireContext(), R.color.white
                )
            )
            binding.helpTvPrecautions.setBackgroundResource(R.drawable.shape_00c1cd_left10)
            binding.helpTvPost.setBackgroundResource(R.drawable.shape_00c1cd_rigt10)

            binding.helpTvOperation.setTextColor(
                ContextCompat.getColor(
                    requireContext(), R.color.color_00C1CD
                )
            )
            binding.helpTvPrecautions.setTextColor(
                ContextCompat.getColor(
                    requireContext(), R.color.white
                )
            )
            binding.helpTvPost.setTextColor(
                ContextCompat.getColor(
                    requireContext(), R.color.white
                )
            )

            binding.helpTvContent.setText(R.string.Operation_Procedure_value)
        }
        binding.helpTvPost.setOnClickListener {
            binding.helpTvPost.setBackgroundResource(R.drawable.shape_white_right10)
            binding.helpTvOperation.setBackgroundColor(
                ContextCompat.getColor(
                    requireContext(), R.color.color_00C1CD
                )
            )
            binding.helpTvPrecautions.setBackgroundResource(R.drawable.shape_00c1cd_left10)

            binding.helpTvPost.setTextColor(
                ContextCompat.getColor(
                    requireContext(), R.color.color_00C1CD
                )
            )
            binding.helpTvPrecautions.setTextColor(
                ContextCompat.getColor(
                    requireContext(), R.color.white
                )
            )
            binding.helpTvOperation.setTextColor(
                ContextCompat.getColor(
                    requireContext(), R.color.white
                )
            )
            binding.helpTvContent.setText(R.string.Post_Treatment_Care_value)
        }
    }
}